/**
 * 统一封装自定义导航栏的适配高度
 */

const { safeAreaInsets } = uni.getSystemInfoSync();

//这个导出是获取我们的状态栏高度
export const getStatusBarHeight = () => safeAreaInsets.top;

// 导出标题高度
export const getTitleBarHeight = () => {
  if (uni.getMenuButtonBoundingClientRect) {
    let { top, height } = uni.getMenuButtonBoundingClientRect();
    return height + (top - getStatusBarHeight()) * 2;
  } else {
    return 40;
  }
};

// 导出我们fill 填充区域高度
export const getNavBarHeight = () => getStatusBarHeight() + getTitleBarHeight();

// 获取我们底部安全区域
export const getBottomHeight = () => safeAreaInsets.bottom;
